package com.ke.service.impl;

import com.ke.dao.OrderItemRepository;
import com.ke.dao.OrderRepository;
import com.ke.pojo.BaseResp;
import com.ke.pojo.Order;
import com.ke.pojo.OrderItem;
import com.ke.service.OrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * @author bochen
 */
@Service
public class OrderItemServiceImpl implements OrderItemService {
    @Autowired
    OrderItemRepository orderItemRepository;
    @Autowired
    OrderRepository orderRepository;
    @Override
    public BaseResp findAll(Integer uid) {
        List<Order> order= orderRepository.findByUid(uid);
        if (order!=null&&order.size()>0){
            return new BaseResp(0,"ok",order);}

        return new BaseResp(1,"od");
    }

    @Override
    public BaseResp orderMsg(String uuid) {
        List<OrderItem> list=orderItemRepository.findByOrderUUID(uuid);
        return new BaseResp(0,"ok",list);
    }
}
